package com.song.winter.context;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;

import java.util.Objects;

public class ApplicationContextUtils {

    private static ApplicationContext applicationContext = null;

    @Nonnull
    public static ApplicationContext getRequiredApplicationContext(){
        return Objects.requireNonNull(getApplicationContext(),"ApplicationContext is not set");
    }



    @Nullable
    static ApplicationContext getApplicationContext(){
        return applicationContext;
    }

    public static void setApplicationContext(AnnotationConfigApplicationContext annotationConfigApplicationContext) {
        applicationContext = annotationConfigApplicationContext;
    }
}
